﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using GreatB2C.Utility;
using GreatB2C.Business;
using GreatB2C.Config.Shop;

namespace GreatB2C.Web.Manage.SystemSet.Shop
{
    public partial class ChoicesetGuide : Inherit.ManagePage
    {
        protected void Page_Load( object sender , EventArgs e )
        {
            if ( !IsPostBack )
            {
                LoadGuide( );
            }
        }

        protected void LoadGuide( )
        {
            StringBuilder sbHtml = new StringBuilder( );

            Business.Dictionary dictBLL = new Dictionary( );
            Model.Dictionary dictModel = dictBLL.ListByFieldName( DataDefine.Dictionary.ProducerType.ToString( ) );
            if ( dictModel != null )
            {
                sbHtml.Append( "<div class=\"guidecollapse\" onclick=\"Switch(this);\">" + DataDefine.NewLine );
                sbHtml.Append( "    <span id=\"Dict_" + dictModel.FieldID.ToString( ) + "\">" + dictModel.Title + "</span>" + DataDefine.NewLine );
                sbHtml.Append( "</div>" + DataDefine.NewLine );
                sbHtml.Append( "<div class=\"guide\" style=\"display: none\">" + DataDefine.NewLine );
                sbHtml.Append( "    <ul>" + DataDefine.NewLine );
                sbHtml.Append( "        <li><a id=\"Dict_" + dictModel.FieldName + "\" href=\"Choiceset.aspx?TableName=" + dictModel.TableName + "&FieldName=" + dictModel.FieldName + "\" target=\"main_right\">" + dictModel.Title + "</a></li>" + DataDefine.NewLine );
                sbHtml.Append( "    </ul>" + DataDefine.NewLine );
                sbHtml.Append( "</div>" + DataDefine.NewLine );
            }

            dictModel = dictBLL.ListByFieldName( DataDefine.Dictionary.TrademarkType.ToString( ) );
            if ( dictModel != null )
            {
                sbHtml.Append( "<div class=\"guidecollapse\" onclick=\"Switch(this);\">" + DataDefine.NewLine );
                sbHtml.Append( "    <span id=\"Dict_" + dictModel.FieldID.ToString( ) + "\">" + dictModel.Title + "</span>" + DataDefine.NewLine );
                sbHtml.Append( "</div>" + DataDefine.NewLine );
                sbHtml.Append( "<div class=\"guide\" style=\"display: none\">" + DataDefine.NewLine );
                sbHtml.Append( "    <ul>" + DataDefine.NewLine );
                sbHtml.Append( "        <li><a id=\"Dict_" + dictModel.FieldName + "\" href=\"Choiceset.aspx?TableName=" + dictModel.TableName + "&FieldName=" + dictModel.FieldName + "\" target=\"main_right\">" + dictModel.Title + "</a></li>" + DataDefine.NewLine );
                sbHtml.Append( "    </ul>" + DataDefine.NewLine );
                sbHtml.Append( "</div>" + DataDefine.NewLine );
            }

            litGuide.Text = sbHtml.ToString( );
        }
    }
}
